using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class ABTestingMap : EntityTypeConfiguration<ABTesting>
    {
        public ABTestingMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Country)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.MasterUrl)
                .IsRequired()
                .HasMaxLength(2480);

            this.Property(t => t.TestingUrls)
                .IsRequired();

            this.Property(t => t.TestingName)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("ABTesting");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.MasterUrl).HasColumnName("MasterUrl");
            this.Property(t => t.TestingUrls).HasColumnName("TestingUrls");
            this.Property(t => t.IsDisabled).HasColumnName("IsDisabled");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.TestingName).HasColumnName("TestingName");
        }
    }
}
